﻿using Masuit.Tools.Security;
using Microsoft.EntityFrameworkCore;
using WebService.EF.Tables;

namespace WebService.EF
{
    public partial class DbService : DbContext
    {

        public DbService(DbContextOptions<DbService> options)
            : base(options)
        {
        }

        public DbSet<SystemUser> SystemUsers { get; set; }
        public DbSet<SystemRole> SystemRoles { get; set; }

        public DbSet<WeighingDataCache> WeighingDataCaches { get; set; }


        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            if (!optionsBuilder.IsConfigured)
            {
                //var version = new MySqlServerVersion(ServerVersion.Parse("8.0.34-mysql"));
                //optionsBuilder.UseMySql("server=localhost;user=akira;password=mysql2014!@akira;database=shipping_system;AllowLoadLocalInfile=true", version, builder =>
                //{
                //    builder.EnableRetryOnFailure();
                //}).EnableDetailedErrors();
                ////.LogTo(log => Debug.WriteLine(log),
                ////     new[] {
                ////         DbLoggerCategory.Database.Command.Name,
                ////         DbLoggerCategory.Update.Name,
                ////         DbLoggerCategory.Query.Name
                ////     }
                ////    );
            }
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            

        }
    }
}
